<#include "/common/defaultEngine.html">
<@pageTheme mark="true">
<!DOCTYPE html>
<html lang="zh-CN" class="" xmlns="http://www.w3.org/1999/html">
<head>
<#import "/common/springctx.ftl" as ctx>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>登录 - J2eeFAST J2eefast.com</title>
    <link href="${ctxStatic}/static/img/favicon.ico" rel="shortcut icon">
    <meta name="keywords" content="PoweredByJ2eeFast"/><meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="authenticity_token" name="csrf-param">
    <#-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/bootstrap.min.css?V=${config.getDvVersion()}">
    <#-- Font Awesome -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/font-awesome.min.css?V=${config.getDvVersion()}">
    <#-- Ionicons -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/Ionicons/css/ionicons.min.css?V=${config.getDvVersion()}">
    <#-- Theme style -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/AdminLTE.min.css?V=${config.getDvVersion()}">
    <#--animate 样式-->
    <link rel="stylesheet" href="${ctxStatic}/static/css/animate.css?V=${config.getDvVersion()}"/>
    <#-- jQuery toast 提示框  -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/jquery.toast.min.css?V=${config.getDvVersion()}">
    <link rel="stylesheet" href="${ctxStatic}/static/css/style.min.css?V=${config.getDvVersion()}">
    <link rel="stylesheet" href="${ctxStatic}/static/css/index.css?V=${config.getDvVersion()}">
    <link href="${ctxStatic}/static/css/gitee/gitee.css" media="screen" rel="stylesheet">
    <link href="${ctxStatic}/static/css/gitee/semantic.css" rel="stylesheet">
    <#-- iCheck -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/iCheck/all.css?V=${config.getDvVersion()}">
    <style>[v-cloak]{display:none !important;} .checkbox label{ padding-left: 0px}
        .ui.error.message, .ui.attached.error.message {
            -webkit-box-shadow: 0px 0px 0px 1px #e0b4b4 inset, 0px 0px 0px 0px rgba(0,0,0,0);
            box-shadow: 0px 0px 0px 1px #e0b4b4 inset, 0px 0px 0px 0px rgba(0,0,0,0);
        }
        .ui.error.message {
            background-color: #FFF6F6;
            color: #9F3A38;
        }
    </style>
    </head>
<body class="session-body">
<#include "/common/notice.html">
<#include "/common/upgrade.html"><!-- 如果客户浏览器版本过低，则显示浏览器升级提示-->
<div class="site-content">
    <div class="fixed-notice-infos">
        <div class="all-messages">
        </div>
        <div class="ui container">
            <div class="flash-messages" id="messages-container"></div>
        </div>
    </div>
    <div class="session-wrapper animated fadeInLeft" id="app" v-cloak>
        <div class="ui container">
            <div class="session__body">
                <div class="session-sidebox">
                    <div class="session-sidebox__container">
                        <div class="session-sidebox__header">
                            <div class="session-sidebox__logo">

                            </div>
                            <h1 class="session-sidebox__title">

                            </h1>
                            <h2 class="session-sidebox__subtitle">
                                ${config.getTitle()}
                            </h2>
                        </div>
                        <div class="session-sidebox__content">
                            <div class="session-sidebox-content__container">
                                <div class="session-sidebox-comments__header"> <span class="session-sidebox-comments__title">当前版本:</span>
                                    <span class="session-sidebox-comments__position">V${config.getVersion()}</span>
                                </div>
                                <div class="session-sidebox-comments__content">
                                    J2eeFAST 是一个 Java EE 企业级快速开发平台，基于经典技术组合（Spring Boot、Spring MVC、Apache Shiro、MyBatis-Plus、Freemarker、Bootstrap、AdminLTE）采用经典开发模式，让初学者能够更快的入门并投入到团队开发中去。 在线代码生成功能，包括核心模块如：组织机构、角色用户、菜单及按钮授权、数据权限、系统参数、内容管理、license认证,BPM工作流等。采用松耦合设计；界面无刷新，一键换肤；众多账号安全设置，密码策略；在线定时任务配置；支持多数据源；支持读写分离、分库分表.
                                </div>
                            </div>
                        </div>
                        <div class="session-sidebox__footer">
                            <a href="https://gitee.com/zhouhuanOGP/J2EEFAST/wikis" target="_blank"><strong class="session-sidebox__icon-hot">帮助文档</strong>
                                <span class="session-sidebox__divider">-</span>
                                码云WiKi
                                <i class="iconfont icon-arrow-circle-right "></i>
                            </a>
                        </div>
                    </div>

                </div>
                <div class="session-form">
                    <div class="session-form__container is-login">
                        <header class="session-form__header">
                            <h2 class="session-form__title">
                                <span><@ctx.i18n text = "欢迎登录"/></span>
                            </h2>
                            <span class="pull-right">
<#--                                没有帐号？<a href="https://gitee.com/signup">点此注册</a>-->
                            </span>
                        </header>
                        <div class="session__flash-error">
                            <div id="msg_error" class="ui message error" style="visibility: hidden">错误提示</div>
                        </div>
                        <form accept-charset="UTF-8" action="${ctxStatic}/login" class="ui custom form session__control session-login__form session-login__with-password "
                            method="post"  autocomplete="off">
                            <div class="session-login__body">
                                <div class="session-form__fields">
                                    <div class="git-login-form-fields">
                                        <div class="field">
                                            <input class="login-password__account-input" id="username" v-model="username" placeholder="<@ctx.i18n text = "账号/邮箱/手机号码"/>" type="text">
                                        </div>
                                        <div class="field">
                                            <input data-encrypt="true" id="password" v-model="password" placeholder="<@ctx.i18n text = "密码"/>" type="password">
                                        </div>
                                        <div v-if="loadcode" class="field">
                                            <div class="ui right labeled input captcha-labeled">
                                                <input class="session-login__captcha-input" v-model="captcha" placeholder="<@ctx.i18n text = "验证码"/>" type="text">
                                                <div class="ui basic orange button session-login__captcha-button" :style="src"  @click="refreshCode">
<#--                                                    <img alt="<@ctx.i18n text = "如果看不清楚，请单击图片刷新!"/>"  :src="src" @click="refreshCode">-->
                                                </div>
                                            </div>
                                        </div>
                                        <div class="two field">
                                            <div class="field">
                                                <div class="checkbox">
                                                    <label title="<@ctx.i18n text = "公共场所慎用,下次登录免输账号"/>" data-toggle="tooltip" data-placement="bottom">
                                                        <input type="checkbox" name="rememberUserCode" data-style="minimal-grey" />&nbsp;<@ctx.i18n text = "记住账号"/>
                                                    </label>
                                                </div>
                                            </div>
                                            <div class="field">
<#--                                                <a class="session__toggle-button" data-control="phone" href="https://gitee.com/login">短信验证登录</a>-->
                                                <div class="checkbox icheck hide">
                                                    <label>
                                                        <input type="checkbox" name="rememberme" v-model="rememberme" data-style="square-blue"> <@ctx.i18n text = "免登录"/>
                                                    </label>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="field">
                                            <input class="ui fluid orange submit button large"@click="login" data-loading="正在验证登录，请稍后..." type="button" value="<@ctx.i18n text = "登 录"/>">
                                        </div>
<#--                                        <div class="field text-center">-->
<#--&lt;#&ndash;                                            <a class="forget-password" href="https://gitee.com/password/new">已有帐号，忘记密码？</a>&ndash;&gt;-->
<#--                                        </div>-->
                                        <div class="dropdown pull-right">
                                            <a href="javascript:" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">
                                                <i class="fa fa-language"></i>&nbsp;<@ctx.i18n text = "中文(简体)"/>
                                            </a>
                                            <ul class="dropdown-menu">
                                                <li class="mt5"></li>
                                                <#list dict.getType('sys_lang_type')>
                                                    <#items as d>
                                                        <#if d.status =='0' >
                                                            <li><a href="${ctxStatic}/login?_lang=${d.dictValue}&view=${loginView}">${d.dictLabel}</a></li>
                                                        </#if>
                                                    </#items>
                                                </#list>
                                                <li class="mt5"></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <div class="session-login-oauth">
                            <div class="session-login__oschina">
<#--                                <a href="https://gitee.com/auth/oschina"><i class="icon-logo-osc iconfont osc"></i>-->
<#--                                    <span>-->
<#--                                        使用 OSChina 帐号登录-->
<#--                                    </span>-->
<#--                                </a>-->
                            </div>
                            <div class="session-login-oauth__container">
                                <div class="field">
                                    <div class="ui horizontal divider session-login__oauth-title">
                                        <span class="text-muted">
                                            其他方式登录
                                        </span>
                                    </div>
                                </div>
                                <div class="text-center">
                                    功能开发中...
                                </div>
                            </div>

                        </div>
                    </div>


                </div>
            </div>
            <div class="session__footer">
                <span class="session__footer-item">
                    Copyright &copy; 2018-${config.getCopyrightYear()} ${config.getCompany()}
                </span>
                <span class="footer-item">
                     <a href="https://gitee.com/zhouhuanOGP/J2EEFAST/wikis">帮助文档</a>
                </span>
                <#list dict.getType('sys_login_view')>
                    <#items as d>
                        <#if d.status =='0' >
                            <span class="footer-item">
                                <a href="${ctxStatic}/login?view=${d.dictValue}">${d.dictLabel}</a>
                            </span>
                        </#if>
                    </#items>
                </#list>
            </div>
            <div class="session__footer">
                <span class="session__footer-item">
                    <a href="http://www.beian.miit.gov.cn/" class="text-black" target="_blank">${config.getIPC()}</a>
                </span>
            </div>
        </div>
    </div>
</div>
<#--jQuery 3 -->
<script src="${ctxStatic}/static/libs/jquery.min.js?V=${config.getDvVersion()}"></script>
<#-- Bootstrap 3.3.7 -->
<script src="${ctxStatic}/static/libs/bootstrap.min.js?V=${config.getDvVersion()}"></script>
<script src="${ctxStatic}/static/plugins/bootstrap-tooltip/bootstrap-tooltip-custom-class.js?V=${config.getDvVersion()}"></script>
<script src="${ctxStatic}/static/libs/SM4.min.js?V=${config.getDvVersion()}"></script>
<#-- iCheck -->
<script src="${ctxStatic}/static/libs/icheck.min.js?V=${config.getDvVersion()}"></script>
<#-- 全局遮罩-->
<script src="${ctxStatic}/static/plugins/blockUI/jquery.blockUI.js?V=${config.getDvVersion()}"></script>
<#-- jQuery toast 提示框  -->
<script src="${ctxStatic}/static/libs/jquery.toast.min.js?V=${config.getDvVersion()}"></script>
<script src="${ctxStatic}/static/libs/jquery.slimscroll.min.js?V=${config.getDvVersion()}"></script>
<script src="${ctxStatic}/static/libs/fastclick.min.js?V=${config.getDvVersion()}"></script>
<#--<script src="${ctxStatic}/statics/libs/app.js?V=${config.getDvVersion()}"></script>-->
<script src="${ctxStatic}/static/libs/vue.min.js?V=${config.getDvVersion()}"></script>
<script>var ctx = "${ctxStatic}/", _secretKey = "${_secretKey}";</script>
<script>
    var vm = new Vue({
        el:'#app',
        data:{
            username: '',
            password: '',
            captcha: '',
            /*errorMsg: '',*/
            rememberme : false,
            loadcode : false,
            src: 'captcha.gif'
        },
        beforeCreate: function(){
            if(self != top){
                top.location.href = self.location.href;
            }
        },
        methods: {
            refreshCode: function(){ /*刷新验证码*/
                this.src = 'background: url("'+ctx+"captcha.gif?t=" + $.now()+'") !important';
            },
            _onkeydown : function(e){
                var that = this;
                if(e && e.keyCode==13) { /* enter 键 */
                    that.login();
                }
            },
            login: function (event) {
                if(this.getCookie("_secretKey") == ""){
                    location.reload();
                    return;
                }
                var s4=new SM4Util(this.getCookie("_secretKey"));
                $(window).block({ message: '<div class="loaderbox"><div class="loading-activity"></div> '
                        + '<@ctx.i18n text = "数据正在认证,请稍后..."/>' + '</div>' });
                $.ajax({
                    type: "POST",
                    url: ctx+"login",
                    data: {"username":s4.encryptData_ECB(vm.username),
                        "password":s4.encryptData_ECB(vm.password),
                        "captcha":vm.captcha,
                        "rememberMe":vm.rememberme},
                    dataType: "json",
                    success: function(result){
                        /*登录成功*/
                        if(result.code == 0){
                            /*获取登陆前用户是否勾选记住账号*/
                            if($("input[name='rememberUserCode']").is(':checked')){
                                window.localStorage.setItem('rememberUserCode',vm.username);
                            }else{
                                window.localStorage.setItem('rememberUserCode',"");
                            };
                            setTimeout(
                                function () {
                                    location.href ='index';
                                }
                                , 100);
                        }else if(result.code == '50004' || result.code == '50006'){
                            $(window).unblock();
                            vm.loadcode = true;
                            vm.errrInfo(result.msg);
                            vm.captcha = '';
                            vm.password = '';
                            vm.refreshCode();
                        }
                        else{
                            $(window).unblock();
                            vm.errrInfo(result.msg);
                            vm.captcha = '';
                            vm.password = '';
                            vm.refreshCode();
                        }
                    }
                });
            },
            errrInfo : function(text){
                <#--$.toast({-->
                <#--    heading: '<@ctx.i18n text = "警告"/>',-->
                <#--    text: text,-->
                <#--    hideAfter:3000,-->
                <#--    position: {-->
                <#--        right: 8,-->
                <#--        bottom: 4-->
                <#--    },-->
                <#--    textAlign: 'left',-->
                <#--    showHideTransition: 'slide',-->
                <#--    allowToastClose: true,-->
                <#--    loader: true,-->
                <#--    /*stack: 5,*/-->
                <#--    icon: 'error'-->
                <#--})-->
                var err = $("#msg_error");
                err.html(text);
                err.css('visibility', 'visible');
                err.removeClass('animated bounceOutUp');
                err.addClass('animated bounceInDown');
                setTimeout(
                    function () {
                        err.removeClass('animated bounceInDown');
                        err.addClass('animated bounceOutUp');
                    }
                    , 5000);

            },
            getCookie:function(c_name){
                if (document.cookie.length>0){
                    c_start=document.cookie.indexOf(c_name + "=");
                    if (c_start!=-1){
                        c_start=c_start + c_name.length+1;
                        c_end=document.cookie.indexOf(";",c_start);
                        if (c_end==-1) {
                            c_end=document.cookie.length
                        };
                        return unescape(document.cookie.substring(c_start,c_end))
                    }
                };
                return _secretKey;
            }
        },
        mounted :function(){
            var that = this;

            if(window.localStorage.getItem('rememberUserCode') && window.localStorage.getItem('rememberUserCode') != ""){
                $("input[name='rememberUserCode']").iCheck('check');
                this.username = window.localStorage.getItem('rememberUserCode');
            }else{
                $("input[name='rememberUserCode']").iCheck('uncheck');
            }

            /*绑定记住我样式*/
            $("input[type=checkbox]").each(function () {
                $(this).iCheck({
                    checkboxClass: "icheckbox_" + ($(this).data("style") || "square-blue"),
                    radioClass: "iradio_" + ($(this).data("style") || "square-blue")
                }).on('ifChanged', function(event){
                    if($(this).attr("name") == "rememberme"){
                        if($(this).is(':checked')){
                            vm.rememberme = true;
                        }else{
                            vm.rememberme = false;
                        }
                    }
                });
            });

            /*设置tooltip*/
            $('[data-toggle="tooltip"]').each(function () {
                $(this).tooltip();
            });

            /*获取页面键盘事件*/
            window.document.onkeydown = that._onkeydown;
        }
    });
</script>
</body>
</html>
</@pageTheme>